﻿using System;
using AutoMapper;
using OrganizationStructureTree.Areas.Default.Models.ViewModels;
using OrganizationStructureTree.Models;

namespace OrganizationStructureTree.Mappers
{
    public class CommonMapper : IMapper
    {
        static CommonMapper()
        {
            Mapper.CreateMap<User, RegisterViewModel>();
            Mapper.CreateMap<RegisterViewModel, User>();
        }

        public object Map(object source, Type sourceType, Type destinationType)
        {
            return Mapper.Map(source, sourceType, destinationType);
        }
    }

    public interface IMapper
    {
        object Map(object source, Type sourceType, Type destinationType);
    }
}